package com.hctforgreen.greenservice;


import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TextView;

/**
 * 2016.9.8
 *
 * @author 390694 终端培训
 */
public class TerminalTrainActivity extends ParentActivity implements OnClickListener {
    private TerminalTrainActivity mSelf;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_terminal_train);

        mSelf = this;
        initSkinLayout();
        initTitleButtonBar();
        initWindow();
    }

    private void initTitleButtonBar() {
        final TextView titleTv = (TextView) findViewById(R.id.tv_title);
        titleTv.setText(getString(R.string.terminal_train_title_hint));
        final ImageButton backBtn = (ImageButton) findViewById(R.id.btn_back);
        backBtn.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                if (getIntent().getBooleanExtra("fromMain", false)) {
                    startActivity(new Intent(TerminalTrainActivity.this, MainActivityV2.class));
                    finish();
                } else {
                    setResult(RESULT_OK);
                    finish();
                }
            }
        });
    }

    private void initWindow() {
        findViewById(R.id.lyt_learning_materials).setOnClickListener(this);// 学习资料
        findViewById(R.id.lyt_examine).setOnClickListener(this);// 考试
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.lyt_learning_materials:// 学习资料
                Intent intent = new Intent(TerminalTrainActivity.this, TerminalLearningMaterialsActivity.class);
                startActivity(intent);
                break;
            case R.id.lyt_examine:// 考试
                intent = new Intent(TerminalTrainActivity.this, TerminalExamActivity.class);
                startActivity(intent);
                break;
            case R.id.lyt_servey:// 调研
                break;
            case R.id.lyt_information_interaction:// 信息交互
                break;
            default:
                break;
        }
    }
}
